home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Prog
/
D-G
/
Generic MPW Tool.cpt
/
GenericTool.c
next >
Wrap
C/C++ Source or Header
|
1991-11-10
|
1KB
|
68 lines
/*
GenericTool.c
Doug Wyatt, May 1991
Freeware.
Source for tiny MPW tool whose entire purpose is to load the rest
of itself from a code resource, PROC 981, which is (typically)
written in THINK C.
Compile and link this file in MPW as follows (the tool is included
in this shareware release):
C GenericTool.c
Link -w -t MPST -c 'MPS ' ∂
GenericTool.c.o ∂
"{CLibraries}"CRuntime.o ∂
"{Libraries}"ToolLibs.o ∂
"{CLibraries}"StdCLib.o ∂
"{CLibraries}"CInterface.o ∂
"{CLibraries}"CSANELib.o ∂
-o GenericTool
Make a copy of Generic Tool and name it whatever you like.
PROC 981 should be built in THINK C as a code resource. Merge it
into a copy of Generic Tool. Its entry point must be declared:
OSErr main(long argc, char *argv[], VoidFunc pPrintf,
VoidFunc pFprintf, long stderr);
*/
#include <types.h>
#include <stdio.h>
#include <ErrMgr.h>
#include <Errors.h>
#include <CursorCtl.h>
#include <Files.h>
#include <Resources.h>
#include <Strings.h>
extern printf(), fprintf();
long main(argc,argv)
int argc;
char *argv[];
{
long status; /* result code */
Handle procH;
InitCursorCtl(nil);
procH = GetResource('PROC',981);
if (procH) {
MoveHHi(procH);
HLock(procH);
status = (* (short (*)())*procH)((long)argc, argv, printf, fprintf, stderr);
ReleaseResource(procH);
} else {
printf("%s - PROC 981 not found", argv[0]);
status = 1;
}
return status;
}